# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=mlt
pkgver=6.22.1
pkgrel=0
pkgdesc="MLT Multimedia Framework"
url="https://www.mltframework.org/"
arch="all"
license="GPL-2.0-or-later AND LGPL-2.1-or-later AND GPL-3.0-or-later"
makedepends="python3-dev ffmpeg-dev libsamplerate-dev sox-dev jack-dev
	gtk+2.0-dev sdl_image-dev frei0r-plugins-dev libxml2-dev fftw-dev
	sdl-dev libexif-dev bsd-compat-headers swig qt5-qtbase-dev qt5-qtsvg-dev"
subpackages="$pkgname-dev py3-$pkgname:py3"
source="https://github.com/mltframework/mlt/archive/v$pkgver/mlt-v$pkgver.tar.gz
	musl-locale.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--avformat-swscale \
		--enable-motion-est \
		--enable-gpl \
		--enable-gpl3 \
		--enable-opencv \
		--disable-rtaudio \
		--swig-languages=python
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

py3() {
	pkgdesc="$pkgdesc (Python bindings)"
	depends="python3"

	_pythonpath=$(python3 -c "from sysconfig import get_path; print(get_path('platlib'))")

	cd "$builddir"/src/swig/python
	mkdir -p "$subpkgdir/$_pythonpath"
	install -m755 mlt.py "$subpkgdir/$_pythonpath"
	install -m755 _mlt.so "$subpkgdir/$_pythonpath"
}

sha512sums="c620b68d35c90eab650c70768a4ae631dec83ece6dd3fd8e09f9300d837d8e0f3da1b098786188f9c1216800f848dd5db7c9e5fa03e816fba3fbcf3c63324c74  mlt-v6.22.1.tar.gz
dfa4c192ce6121a3c86141c46a08eaf6cd6bd81c120786bdb1ef564bf7878dcb44031280b34609048409c3d09e8c0e1bd430dae1fe777ef030daf09b1dfd90a3  musl-locale.patch"
